package com.fingard.io;

import java.io.File;
import java.util.Date;

import com.fingard.FGBiz;
import com.fingard.constant.Format;
import com.fingard.text.StringHelper;

public class FgFileHelper {

    public static String createTempFileDirectory(String p_subDir) {
        String tmpByDate = Format.Date8Format.format(new Date());
        tmpByDate = tmpByDate.substring(0, 6) + File.separator + tmpByDate.substring(6, 8);
        String dir = FGBiz.dspCenter.dspSet.dataDirPath + File.separator + "tempfile" + File.separator + tmpByDate;
        if(StringHelper.hasAnyChar(p_subDir)){
        	dir+=File.separator + p_subDir;
        }
        File mdDir = new File(dir);
        if (!mdDir.exists()) {
            mdDir.mkdirs();
        }
        return dir;
    }
}
